package kuzmenkov.oip.controller.applet;

import java.awt.FlowLayout;
import java.util.List;

import javax.swing.JLabel;

/**
 * An UI component that is responsible for displaying of polygons. It displays
 * polygons on a component that support displaying of polygons.
 * @author Michael Kuzmenkov
 *
 */
public class PolygonsUIC extends ParamUIC{

	/**
	 * 
	 */
	private static final long serialVersionUID = 8987077125236115589L;
	/**
	 * An UI component that supports displaying polygons.
	 */
	private IPolygonSupportedUIC polSuppUIC;
	
	protected PolygonsUIC(Param param, IPolygonSupportedUIC uic) {
		super(param);
		this.polSuppUIC = uic;
		init();
	}
	
	private void init() {
		Param param = getParam();
		String name = param.getName();
		String tip = I18nTool.getInstance().getMessage("polygonsTip");
		

		JLabel label = new JLabel(name);
		label.setToolTipText(tip);
		
		setLayout(new FlowLayout(FlowLayout.LEFT));
		
		add(label);
		
	}

	public Object getValue() {
		
		return polSuppUIC.getPolygons();
	}

	public void setValue(Object object) {
		polSuppUIC.setPolygons((List)object);
	}

}
